package com.hewep.demo.nio;

import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

public class Response {

	private SocketChannel sc;
	
	public Response(SocketChannel sc){ 
		this.sc = sc;
	}
	
	public void send(byte[] data) throws Exception{
		
		ByteBuffer buffer = ByteBuffer.allocate(data.length);
		buffer.put(data, 0, data.length);
		buffer.flip();
		sc.write(buffer);
	}
}
